/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.snda.dw.hiveapi.hiveapitest;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 *
 * @author lidejia
 */
public class HiveJobExecutor {

    private static HiveJobExecutor instance = null;

    public static synchronized HiveJobExecutor getInstance() {
        if (instance == null) {
            instance = new HiveJobExecutor();
        }
        return instance;
    }
    // thread pool
    private ExecutorService es = Executors.newCachedThreadPool();

    private HiveJobExecutor() {
    }

    public Future<HiveQueryResult> execute(HiveJob job) {
        return es.submit(job);
    }
}
